home *** CD-ROM | disk | FTP | other *** search
Wrap
''************************************************************************** ''* SST Setup Script... ''************************************************************************** ''*** DEFINE DEBUG ''Define for script development/debugging '$INCLUDE 'setupapi.inc' '$INCLUDE 'msdetect.inc' DECLARE FUNCTION InstallCarousel LIB "MSCUISTF.dll" ( DestDir$ ) AS INTEGER ''Dialog ID's CONST WELCOME = 100 CONST ASKQUIT = 200 CONST DESTPATH = 300 CONST EXITFAILURE = 400 CONST EXITQUIT = 600 CONST EXITSUCCESS = 700 CONST EXITRUNTIME = 750 CONST OPTIONS = 800 CONST APPHELP = 900 CONST BADPATH = 6400 CONST SpaceNeeded& = 1500000 ''Bitmap ID CONST LOGO = 1 GLOBAL DEST$ ''Default destination directory. GLOBAL OPTCUR$ ''Option selection from option dialog. GLOBAL FreeSpace& GLOBAL WinDir$ '' Stores Windows Directory GLOBAL SrcDir$ '' Source Directory path GLOBAL szInf$ DECLARE SUB Install DECLARE SUB UpdateINIfiles DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING DECLARE FUNCTION CheckForVFW () AS INTEGER INIT: CUIDLL$ = "mscuistf.dll" ''Custom user interface dll HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure SetBitmap CUIDLL$, LOGO SetTitle "Wolf Hollow CD ROM Setup" Temp$ = "Version 1.1" + CHR$(13) + "Copyright (C) 1994, AskMe Multimedia, Inc." SetAbout "SST Super Show & Tell", TEMP$ szInf$ = GetSymbolValue("STF_SRCINFPATH") IF szInf$ = "" THEN szInf$ = GetSymbolValue("STF_CWDDIR") + "SSTINF.INF" END IF ReadInfFile szInf$ OPTCUR$ = "1" DEST$ = "C:\WolfH" '$IFDEF DEBUG i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal WinDrive$ = MID$(GetWindowsDir, 1, 1) IF IsDriveValid(WinDrive$) = 0 THEN i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK) GOTO QUIT END IF '$ENDIF ''DEBUG WELCOME: sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN UIPop 1 ELSE GOSUB ASKQUIT GOTO WELCOME END IF ISWINDOWS31: ' Check Windows Version... Must be 3.1 or greater... MajorVer% = GetWindowsMajorVersion() MinorVer% = GetWindowsMinorVersion() IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN i% = DoMsgBox("SST First Edition requires Microsoft Windows version 3.10 or greater. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END END IF GETPATH: SetSymbolValue "EditTextIn", DEST$ SetSymbolValue "EditFocus", "END" GETPATHL1: sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$) DEST$ = GetSymbolValue("EditTextOut") IF sz$ = "CONTINUE" THEN IF IsDirWritable(DEST$) = 0 THEN GOSUB BADPATH GOTO GETPATHL1 END IF DESTDRIVE$ = MID$(DEST$, 1, 1) FreeSpace& = GetFreeSpaceForDrive(DEST$) IF FreeSpace& < SpaceNeeded& THEN GOSUB MORESPACE GOTO GETPATHL1 ENDIF UIPop 1 ELSEIF sz$ = "REACTIVATE" THEN GOTO GETPATHL1 ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO WELCOME ELSE GOSUB ASKQUIT GOTO GETPATH END IF WinDir$ = GetWindowsDir() Install CursorState% = ShowWaitCursor() UpdateINIfiles ' IF (CheckForVFW > 0 ) THEN ' ' Need to Install VFW 1.1 ' IF CheckForVFW = 1 THEN ' ' Old Version found ' Temp$ = "An old runtime version of Video for Windows was found " ' Temp$ = Temp$ + "on your machine. " ' Temp$ = Temp$ + CHR$(13) +CHR$(13)+ "Please run the SETUP program " ' Temp$ = Temp$ + "located in the \SST\VFW1-1 directory on this CD ROM " ' Temp$ = Temp$ + "to install the runtime for Video for Windows 1.1." ' Temp$ = Temp$ + CHR$(13) + CHR$(13) + "This will allow SST to properly play Video for Windows Movies." ' ELSE ' ' No Version Found ' Temp$ = "Video for Windows 1.1 has not been located on your machine. " ' Temp$ = Temp$ + CHR$(13) +CHR$(13)+ "Please run the SETUP program " ' Temp$ = Temp$ + "located in the \SST\VFW1-1 directory on this CD ROM " ' Temp$ = Temp$ + "to install the runtime for Video for Windows 1.1." ' Temp$ = Temp$ + CHR$(13) + CHR$(13) + "This will allow SST to play Video for Windows Movies." ' ' END IF ' ' ' i% = DoMsgBox(Temp$, "Attention Installer!", MB_OK+MB_TASKMODAL+MB_ICONHAND) ' END IF RestoreCUrsor CursorState% ' Dave, tell'em about video for Windows Runtime here... Temp$ = "If you expirence difficulty with the video portion of Wolf Hollow, " Temp$ = Temp$ + "please run the SETUP program located in the \VFW1-1 directory " Temp$ = Temp$ +"on this CD ROM." i% = DoMsgBox(Temp$, "Attention Installer!", MB_OK+MB_TASKMODAL+MB_ICONHAND) CloseLogFile QUIT: ON ERROR GOTO ERRQUIT IF ERR = 0 THEN dlg% = EXITRUNTIME ELSEIF ERR = STFQUIT THEN dlg% = EXITQUIT ELSE dlg% = EXITFAILURE END IF QUITL1: sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO QUITL1 END IF UIPop 1 END ERRQUIT: i% = DoMsgBox("Setup sources were corrupted, call (612) 531-0603!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND) END BADPATH: sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO BADPATH END IF UIPop 1 RETURN MORESPACE: Temp$ = "The Wolf Hollow CD needs " + STR$(SpaceNeeded&) + " bytes to install." + CHR$(13) Temp$ = Temp$ + "There is only " + STR$(FreeSpace&) +" bytes free." i% = DoMsgBox( Temp$, "Not Enough Disk Space", MB_OK+MB_TASKMODAL+MB_ICONHAND) RETURN ASKQUIT: sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO ASKQUIT ELSE UIPop 1 END IF RETURN '** '** Purpose: '** Builds the copy list and performs all installation operations. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB Install STATIC SrcDir$ = GetSymbolValue("STF_SRCDIR") CreateDir DEST$, cmoNone OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0 WriteToLogFile "current working dir is "+szInf$ WriteToLogFile "Source Dir is " + SrcDir$ AddSectionFilesToCopyList "Files", SrcDir$ + "SST\", DEST$ AddSectionFilesToCopyList "Icons", SrcDir$, DEST$ AutoDesk$ = GetIniKeyString( "WIN.INI", "AAPLAY Animation", "FullScreen" ) IF AutoDesk$ = "" THEN AddSectionFilesToCopyList "AAPLAY", SrcDir$ + "SST\", WinDir$ + "SYSTEM" WriteToLogFile "AAPLAY Animation not found in WIN.INI, copying AAPLAY.DLL" ELSE WriteToLogFile "Found AAPLAY Animation in WIN.INI - Checking for AAVGA.DLL and AAPLAY.DLL" AAVGA$ = FindFileInTree("AAVGA.DLL", WinDir$) WriteToLogFile "Search result for AAVGA.dll is |" + AAVGA$ + "|" AAPLAY$ = FindFileInTree("AAPLAY.DLL", WinDir$) WriteToLogFile "Search result for AAPLAY.dll is |" + AAPLAY$ + "|" IF AAPLAY$ = "" THEN ' Remove Section from INI file when AAPLAY.DLL not found. i% = FRemoveIniSection ( "WIN.INI", "AAPLAY Animation", cmoForce) AddSectionFilesToCopyList "AAPLAY", SrcDir$ + "SST\", WinDir$ + "SYSTEM" WriteToLogFile "Will copy AAPLAY.DLL" ELSE WriteToLogFile "Will not copy AAPLAY.DLL, found another version." ENDIF ENDIF CopyFilesInCopyList END SUB SUB UpdateINIfiles STATIC '' Update SST's INI file with installed paths. INIFile$ = DEST$ + "\SST.INI" CreateIniKeyValue INIFile$, "SST", "picturedir", SrcDir$ + "Content\Photos", cmoOverwrite CreateIniKeyValue INIFile$, "SST", "picturetype", "1", cmoOverwrite CreateIniKeyValue INIFile$, "SST", "sounddir", SrcDir$ + "Content\Sounds", cmoOverwrite CreateIniKeyValue INIFile$, "SST", "soundtype", "1", cmoOverwrite CreateIniKeyValue INIFile$, "SST", "carouseldir", SrcDir$ + "Samples", cmoOverwrite CreateIniKeyValue INIFile$, "SST", "userselectdir", DEST$, cmoOverwrite CreateIniKeyValue INIFile$, "SST", "altered", "0", cmoOverwrite CreateIniKeyValue INIFile$, "SST", "moviedir", SrcDir$ + "Content\Movies", cmoOverwrite CreateIniKeyValue INIFile$, "SST", "movietype", "2", cmoOverwrite CreateProgmanGroup "Wolf Hollow CD ROM", "", cmoNone ShowProgmanGroup "Wolf Hollow CD ROM", 1, cmoNone ' Icons in group are below. NoIcon$ = ", , 1, 1," + DEST$ Icon16Bit$ = DEST$ + "\I16Bit.ico, , 1, 1," + DEST$ Icon8Bit$ = DEST$ + "\I8Bit.ico, , 1, 1," + DEST$ CreateProgmanItem "Wolf Hollow CD ROM", "Read Me 1ST", "Write.exe " + Dest$+"\ReadMe.wri", NoIcon$, cmoOverwrite Path$ = DEST$ + "\SST.exe " + SrcDir$ + "WolfHol\WolfH16.Car" CreateProgmanItem "Wolf Hollow CD ROM", "Wolf Hollow 16bit", Path$, Icon16Bit$, cmoOverwrite Path$ = DEST$ + "\SST.exe " + SrcDir$ + "WolfHol\WolfH8.Car" CreateProgmanItem "Wolf Hollow CD ROM", "Wolf Hollow 8bit", Path$, Icon8Bit$, cmoOverwrite ' Path$ = "Write.exe "+ SrcDir$ + "Order\Order.Wri" ' CreateProgmanItem "Ask Me Multimedia", "Order", Path$, NoIcon$, cmoOverwrite '' CloseLogFile END SUB '** '** Purpose: '** Appends a file name to the end of a directory path, '** inserting a backslash character as needed. '** Arguments: '** szDir$ - full directory path (with optional ending "\") '** szFile$ - filename to append to directory '** Returns: '** Resulting fully qualified path name. '************************************************************************* FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING IF szDir$ = "" THEN MakePath = szFile$ ELSEIF szFile$ = "" THEN MakePath = szDir$ ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN MakePath = szDir$ + szFile$ ELSE MakePath = szDir$ + "\" + szFile$ END IF END FUNCTION FUNCTION CheckForVFW STATIC AS INTEGER CheckForVFW = 0 AVIVideo$ = GetIniKeyString( "SYSTEM.INI", "MCI", "AVIVideo" ) WriteToLogFile "AVIVideo$ is " + AVIVideo$ IF AVIVideo$ <> "" THEN Version$ = GetVersionOfFile(AVIVideo$) WriteToLogFile "AVIVideo Version is " + Version$ NthField& = GetVersionNthField(Version$, 1) IF NthField& <= 1 THEN NthField& = GetVersionNthField(Version$, 2) IF NthField& < 10 THEN CheckForVFW = 1 ' Found Old Version END IF END IF ELSE CheckForVFW = 2 ' Did not find VFW Runtime END IF END FUNCTION